// 页面滚动时添加动画效果
document.addEventListener('DOMContentLoaded', function() {
    // 检查元素是否在视口内
    function isInViewport(element) {
        const rect = element.getBoundingClientRect();
        return (
            rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
            rect.bottom >= 0
        );
    }

    // 应用动画效果
    function applyAnimations() {
        const fadeElements = document.querySelectorAll('.fade-in-up');
        fadeElements.forEach(function(element) {
            if (isInViewport(element)) {
                element.classList.add('animate');
            }
        });
    }

    // 初始执行一次
    applyAnimations();

    // 滚动时执行
    window.addEventListener('scroll', applyAnimations);

    // 团队成员卡片交互
    const teamCards = document.querySelectorAll('.team-member-card');
    teamCards.forEach(card => {
        card.addEventListener('mouseenter', function() {
            this.querySelector('.member-info').classList.add('opacity-100');
            this.querySelector('.member-info').classList.remove('opacity-75');
        });
        
        card.addEventListener('mouseleave', function() {
            this.querySelector('.member-info').classList.remove('opacity-100');
            this.querySelector('.member-info').classList.add('opacity-75');
        });
    });

    // 指导卡片交互
    const guideCards = document.querySelectorAll('.guide-card');
    guideCards.forEach(card => {
        card.addEventListener('mouseenter', function() {
            this.querySelector('.card-title').classList.add('text-primary');
        });
        
        card.addEventListener('mouseleave', function() {
            this.querySelector('.card-title').classList.remove('text-primary');
        });
    });
}); 